package top.jolyoulu.codegenweb.service.dal.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.jolyoulu.codegenweb.dao.MysqlTableColumnMapMapper;
import top.jolyoulu.codegenweb.entity.po.MysqlTableColumnMap;
import top.jolyoulu.codegenweb.service.dal.MysqlTableColumnMapService;

/**
 * @Author: JolyouLu
 * @Date: 2023/4/15 14:13
 * @Description
 */
@Slf4j
@Service
public class MysqlTableColumnMapServiceImpl extends ServiceImpl<MysqlTableColumnMapMapper,MysqlTableColumnMap> implements MysqlTableColumnMapService {

    @Autowired
    private MysqlTableColumnMapMapper mysqlTableColumnMapMapper;

    @Override
    public MysqlTableColumnMap getByDataType(Integer mapOnto, String dataType) {
        LambdaQueryWrapper<MysqlTableColumnMap> ew = new LambdaQueryWrapper<>();
        ew.eq(MysqlTableColumnMap::getMapOnto,mapOnto);
        ew.eq(MysqlTableColumnMap::getDataType,dataType);
        return mysqlTableColumnMapMapper.selectOne(ew);
    }
}
